package io.github.harmonly.skyblock.command;

import dev.jorel.commandapi.CommandAPI;
import dev.jorel.commandapi.CommandAPICommand;
import io.github.harmonly.skyblock.manager.DataManager;

public class LobbyCommand implements SBCommand {

    @Override
    public String name() {
        return "lobby";
    }

    @Override
    public void register() {
        new CommandAPICommand("lobby")
                .withAliases("l")
                .executesPlayer((sender, args) -> {
                    DataManager.getPlayerData(sender).ifPresent(playerData -> {
                        playerData.teleportTo("worlds/main_lobby");
                        DataManager.saveProfileData(sender);
                    });
                })
                .register();
    }

    @Override
    public void unregister() {
        CommandAPI.unregister("lobby");
    }
}
